#include "gd32f10x.h"                   // Device header
#include "bsp.h"
int main(void)
{
    uint16_t count = 0;
    bsp_init();
    printf("INA226 ID:%d\r\n", INA226_Get_ID(INA226_ADDR1));
    while(1)
    {
        LED0=~LED0;
        delay_ms(500);
        
        INA226_Get_BusVoltage(INA226_ADDR1,&INA226_data);
        printf("INA226 bus votage:%f\r\n", INA226_data.voltageVal);
        
        INA226_Get_ShuntVoltage(INA226_ADDR1,&INA226_data);
        printf("          current:%f\r\n", INA226_data.Shunt_voltage);
        
        INA226_Get_ShuntCurrent(INA226_ADDR1,&INA226_data);
        printf("          current:%f\r\n", INA226_data.Shunt_Current);
        
        INA226_Get_Power(INA226_ADDR1,&INA226_data);
        printf("            power:%f\r\n", INA226_data.powerVal);
        count++;
        printf("\r\nSystem has run for %d second \r\n", count);
    }
}
